package com.xbongbong.saas.domain.dao;

import com.xbongbong.saas.domain.entity.CabinetFileEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 *
 * @author 魏荣杰
 * @date 2019/6/20 15:25
 * @since v1.0
 * @version v1.0
 */
@Repository
@Mapper
public interface CabinetFileDao {
    Integer insert(CabinetFileEntity cabinetFile);

    Integer update(CabinetFileEntity cabinetFile);

    Integer deleteByKey(@Param("key") Long key, @Param("corpid")String corpid);

    CabinetFileEntity getByKey(@Param("key") Long key, @Param("corpid")String corpid);

    List<CabinetFileEntity> findEntitys(@Param("param") Map<String, Object> param);

    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    void insertBatch(List<CabinetFileEntity> cabinetFileEntityList);

    List<CabinetFileEntity> getCabinetFiles(@Param("corpid") String corpid, @Param("dataId") Long dataId, @Param("businessType") Integer businessType, @Param("type") Integer type, @Param("refId") Long refId);

    List<CabinetFileEntity> getCabinetFilesByUserId(@Param("corpid") String corpid, @Param("userId") String userId, @Param("businessType") Integer businessType);

    Long getAllSizeByCorpid(@Param("corpid") String corpid);

    Integer deleteBatch(@Param("idIn") List<Long> idIn, @Param("corpid") String corpid);

    List<CabinetFileEntity> getCabinetFilesByIdIn(@Param("corpid") String corpid, @Param("dataIdIn") List<Long> dataIdIn, @Param("businessType") Integer businessType);

    void updateBatch(@Param("list")List<CabinetFileEntity> cabinetFileEntities,@Param("corpid")  String corpid);

    /**
     * 批量插入文件柜照片，用于资金三期脚本迁移
     *
     * @param cabinetFileModelEntitys
     * @return
     */
    int insertBatchAll(@Param("list") List<CabinetFileEntity> cabinetFileModelEntitys);

    List<Long> getCabinetFileIdsByIdIn(@Param("corpid") String corpid, @Param("dataIdIn") List<Long> dataIdIn, @Param("businessType") Integer businessType);
}
